<?php

session_start();

if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {

    header("Location: login.php");
}

//==========================================
//	ESCAPE DANGEROUS SQL CHARACTERS
//==========================================
//
//include 'i_functions.php';
//
//include 'i_ClaimInit.php';
//
$_SESSION['Work'] = array();

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $ClaimID = $_GET['ClaimID'];
    //print "ClaimID=" . $ClaimID . "<br>";
    $ID = htmlspecialchars($ClaimID);

    //==========================================
    //	CONNECT TO THE LOCAL DATABASE
    //==========================================
    $user_name = "root";
    $pass_word = "haddons";
    $database = "PPI";
    $server = "127.0.0.1";

    $db_handle = mysql_connect($server, $user_name, $pass_word);
    $db_found = mysql_select_db($database, $db_handle);
    //
// get list of Lenders
//
    //$SelName = "Lender";
    /* $FileName = "PPI.lenders";
      $Columns = array("ID", "LenderName", "Address1", "Address2");
      $Options = array();
      $Options["Name"] = "Lender";
      $Options["OrderBy"] = "LenderName";
      $LenderSelect = SelectList($FileName, $Columns, $Options); */

    $QHTML = BuildForm("StatusForm.csv", $_SESSION['Work'], $db_handle);
    include 'i_head.php';
    print "<br>
        <div>
            <form name=\"StatusCodes\" method=\"post\" action=\"UpdateStatus.php\">
                <input name=\"ClaimID\" type=\"hidden\" id = \"ClaimID\" value=\"<?PHP print $ClaimID ?>\"/>
                <table id=\"form\" align=\"center\" cellspacing=\"0\"cellpadding=\"0\">
                    <tr class=\"col_head\">
                        <td >&nbsp;</td>
                        <td><h1>Mainitain Status Codes</h1></td>
                    </tr>";
    print $QHTML;
    print "<tr>
                        <td></td><td><br><input id=\"btnsubmit\" name=\"btnsubmit\" type=\"submit\" value=\"Submit\" onClick=\"return(valid(document.frmclaim.txttele));\" />
                        </td>
                    </tr> 
                </table>
            </form>
        </div>";
    include 'i_foot.html';

    /* if ($db_found && $ClaimID != "NEW") {

      $SQL = "SELECT * FROM claims WHERE ID = '$ID'";
      print $SQL . "<br>";
      $result = mysql_query($SQL);
      $num_rows = mysql_num_rows($result);
      //====================================================
      //	CHECK TO SEE IF THE $result VARIABLE IS TRUE
      //====================================================
      if ($result) {
      include 'i_head.php';
      if ($num_rows > 0) {
      $db_field = mysql_fetch_assoc($result);
      // foreach ($db_field as $key_name => $key_value) {
      //  print $key_name . "=" . $key_value . "<BR>";
      //  }
      //$ID = $db_field['ID'];
      $ClientID = $db_field['ClientID'];
      $LenderID = $db_field['LenderID'];
      $LoanNo = $db_field['LoanNo'];
      $LoanStartDate = $db_field['LoanStartDate'];
      $LoanType = $db_field['LoanType'];
      switch($LoanType) {
      case "L":
      $LoanType_L = "checked";
      break;
      case "C":
      $LoanType_C = "checked";
      break;
      default:
      $LoanType_M = "checked";
      break;
      }
      $LoanAmount = $db_field['LoanAmount'];
      $LoanDuration = $db_field['LoanDuration'];
      include 'i_ClaimForm.php';
      } else {
      $message = "not found!";
      print $message;
      }
      include 'i_foot.html';
      }
      } else {
      //print "should be here<br>";
      include 'i_head.php';
      include 'i_ClaimForm.php';
      include 'i_foot.html';
      } */
}
?>